<?php

namespace app\mobile\controller;

use app\BaseController;
use app\mobile\model\Dictionary;

class DictionaryController extends BaseController
{

    public function dictionaryList()
    {
        $all = input('param.');

        $flist = Dictionary::where('parent_id',0)
            //->where('is_delete',2)
            ->order('sort asc')
            ->select();
        foreach ($flist as $key => $val){
            $parent_id = $val['id'];
            $clist = Dictionary::where('parent_id',$parent_id)
                //->where('is_delete',2)
                ->order('sort asc')
                ->select()->toArray();

            $flist[$key]['children'] = $clist;
        }
        return $this->suc_json('',$flist);
    }

}